package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysAttach;
import com.ruoyi.system.mapper.SysAttachMapper;
import com.ruoyi.system.service.ISysAttachService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 素材附件Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-10
 */
@Service
public class SysAttachServiceImpl implements ISysAttachService 
{
    @Resource
    private SysAttachMapper sysAttachMapper;

    /**
     * 查询素材附件
     * 
     * @param id 素材附件主键
     * @return 素材附件
     */
    @Override
    public SysAttach selectSysAttachById(Long id)
    {
        return sysAttachMapper.selectSysAttachById(id);
    }

    /**
     * 查询素材附件列表
     * 
     * @param sysAttach 素材附件
     * @return 素材附件
     */
    @Override
    public List<SysAttach> selectSysAttachList(SysAttach sysAttach)
    {
        return sysAttachMapper.selectSysAttachList(sysAttach);
    }

    /**
     * 新增素材附件
     * 
     * @param sysAttach 素材附件
     * @return 结果
     */
    @Override
    public int insertSysAttach(SysAttach sysAttach)
    {
        sysAttach.setCreateTime(DateUtils.getNowDate());
        return sysAttachMapper.insertSysAttach(sysAttach);
    }

    /**
     * 修改素材附件
     * 
     * @param sysAttach 素材附件
     * @return 结果
     */
    @Override
    public int updateSysAttach(SysAttach sysAttach)
    {
        sysAttach.setUpdateTime(DateUtils.getNowDate());
        return sysAttachMapper.updateSysAttach(sysAttach);
    }

    /**
     * 批量删除素材附件
     * 
     * @param ids 需要删除的素材附件主键
     * @return 结果
     */
    @Override
    public int deleteSysAttachByIds(Long[] ids)
    {
        return sysAttachMapper.deleteSysAttachByIds(ids);
    }

    /**
     * 删除素材附件信息
     * 
     * @param id 素材附件主键
     * @return 结果
     */
    @Override
    public int deleteSysAttachById(Long id)
    {
        return sysAttachMapper.deleteSysAttachById(id);
    }
}
